<?php
	// Work-around for setting up a session because Flash Player doesn't send the cookies
	if (isset($_POST["PHPSESSID"])) {
		session_id($_POST["PHPSESSID"]);
	}
	include("function.php");

	// The Demos don't save files

        if (!isset($_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) {
                echo "There was a problem with the upload";
                exit(0);
        } else {
			
			$newname = explode(".",$_FILES["Filedata"]["name"]);
			$newname = date("YmdHis").rand(1000,9999).".".$newname[1];
			
			$valuearray['it_pic'] = $newname;
			$valuearray['it_session'] = str_replace("PHPSESSID=","",$_SERVER['HTTP_COOKIE']);
			//$valuearray['it_session'] = "".$_SESSION['mysess'];
			
			
			imgResizeSave("../imgs/",$valuearray['it_pic'],30,$_FILES["Filedata"]["tmp_name"]);
			//@copy($_FILES["Filedata"]["tmp_name"],"../imgs/".$valuearray['it_pic']);


			Qinsert("imagestmp","",$valuearray);


		}




	
	exit(0);
?>